<?php
namespace app\zhongcan\validate;

use think\Validate;

class NewsValidate extends Validate
{

    protected $rule = [
      'title' => 'require|max:20|min:4',
      'author'=>'require',
      'url'=>'require',
      'abstract'=>'require',
      'content'=>'require',
      'image'=>'require',
      'look_num'=>'require',
    ];

    protected $message = [
      'title.require'=>'请输入标题',
      'title.max'=>'标题不能超过20字',
      'title.min'=>'标题不能少于4字',
      'url.require'=>'请输入网页跳转地址',
      'abstract.require'=>'请输入摘要',
      'content.require'=>'请输入文本内容',
      'image.require'=>'请上传图片',
      'look_num.require'=>'请输入浏览量',
    ];

    protected $scene = [
      'add' =>['title','author','content']  ,
      'edit'=>['title','author','content']  ,
    ];
}